<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>首页</title>
<link rel="stylesheet" href="${ctx}/static/js/layui/css/layui.css">
</head>
<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin">
		<div class="layui-header">
			<div class="layui-logo">权限管理平台</div>
			<ul class="layui-nav layui-layout-right">
				<li class="layui-nav-item"><a href="javascript:;"> <img
						src="${ctx}/common/getImage?name=<shiro:principal property="headImg"/>" class="layui-nav-img"> <shiro:principal property="username"/>
				</a>
				</li>
				<li class="layui-nav-item"><a href="logout">注销</a></li>
			</ul>
		</div>

		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree" lay-filter="test">
					<c:forEach items="${menus}" var="menu">
						<li class="layui-nav-item layui-nav-itemed">
							<a class="" href="javascript:;">${menu.menuName }</a>
							<dl class="layui-nav-child">
								<c:forEach items="${menu.children}" var="menu2">
									<dd>
										<a href="javascript:;" data-url="${ctx}${menu2.url}?menuId=${menu2.id}">${menu2.menu_name}</a>
									</dd>	
								</c:forEach>
							</dl>
						</li>
					</c:forEach>
				</ul>
			</div>
		</div>

		<div class="layui-body">
			<!-- 内容主体区域 -->
			<div style="padding: 15px;" class="hh_body"></div>
		</div>

		<div class="layui-footer">
			<!-- 底部固定区域 -->
			© layui.com - 底部固定区域
		</div>
	</div>
	<script src="${ctx}/static/js/layui/layui.js"></script>
	<script>
		//JavaScript代码区域
		layui.use('element', function(){
		  	var element = layui.element;
		  	var $ = layui.$;
		  	
		  	//给每个菜单添加点击事件
		  	$('dl.layui-nav-child>dd').click(function (){
		  		//获取a标签中data-url属性中的值
		  		var url = $(this).find("a").attr("data-url");
		  		$('.hh_body').load(url);
		  	})
		});
	</script>
</body>
</html>